package com.maslyk.invitation.entitybean;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


/**
 * The persistent class for the auditlog database table.
 * 
 */
@Entity
@Table(name="auditlog")
public class Auditlog implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Basic(optional = false)
	@Column(name = "id")
	private Integer id;
	
	@Column(name="action")
	private String action;

    @Temporal( TemporalType.TIMESTAMP)
	private Date createdDate;

    @Lob()
    @Column(name="detail")
	private String detail;
	
    @Column(name="entityId")
	private Integer entityId;
    
	@Column(name="entityName")
	private String entityName;
	
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, targetEntity = Salesman.class)
	@JoinColumn(name = "operatorId")
	private Salesman operatorId;
	
	@Column(name="objectKey")
	private String objectKey;
	

    public Auditlog() {
    }

    public Auditlog(Salesman operatorId, String action, String detail,
    		Date createdDate, Integer entityId, String entityName, String key){
    	this.operatorId = operatorId;
    	this.action = action;
    	this.detail = detail;
    	this.createdDate = createdDate;
    	this.entityId = entityId;
    	this.entityName = entityName;
    	this.objectKey = key;
    }
    
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getAction() {
		return this.action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public String getDetail() {
		return this.detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public Integer getEntityId() {
		return this.entityId;
	}

	public void setEntityId(Integer entityId) {
		this.entityId = entityId;
	}

	public String getEntityName() {
		return this.entityName;
	}

	public void setEntityName(String entityName) {
		this.entityName = entityName;
	}

	public Salesman getOperatorId() {
		return operatorId;
	}

	public void setOperatorId(Salesman operatorId) {
		this.operatorId = operatorId;
	}

	public String getObjectKey() {
		return objectKey;
	}

	public void setObjectKey(String objectKey) {
		this.objectKey = objectKey;
	}

	public String getKey() {
		return String.valueOf(id);
	}
}